home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!tektronix!tekgen!tekred!games
- From: games@tekred.TEK.COM
- Newsgroups: comp.sources.games
- Subject: v05i099: matchmkr2 - network matchmaking driver
- Message-ID: <3438@tekred.TEK.COM>
- Date: 3 Jan 89 20:10:49 GMT
- Sender: billr@tekred.TEK.COM
- Lines: 882
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted by: jon@bodedo.ucm.org (Jon Boede)
- Comp.sources.games: Volume 5, Issue 99
- Archive-name: matchmkr2
-
- [This is a revision of a game posted earlier. It has some bug
- fixes applied, changed questions and a new server machine. -br]
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: README matchmaker.c
- # Wrapped by billr@saab on Tue Jan 3 09:56:21 1989
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(442 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XThis is a program that allows people to start corresponding with a
- Xmatchmaking gateway daemon. The gateway links a BBS network with regular
- Xsystem mail... what this program does is generates a text letter for one to
- Xmail to the request daemon, which will mail them back a help file (which I
- Xfigure is easier to update in the future) and a "match list". People can then
- Xcorrespond with the regular BBS users or with other UseNet users, etc.
- END_OF_FILE
- if test 442 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'matchmaker.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'matchmaker.c'\"
- else
- echo shar: Extracting \"'matchmaker.c'\" \(22563 characters\)
- sed "s/^X//" >'matchmaker.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include <ctype.h>
- X
- X/* compile this with: cc -O matchmaker.c -o matchmaker
- X * it probably belongs in /usr/games/matchmaker */
- X
- X/*
- X Copyright (C) 1987, Jon Boede (Author) (jon@bodedo.ucm.org).
- X
- X This is a published work. Unlimited distribution of this program,
- X not-for-profit, is authorized. Unlimited use of this program and the
- X gateway server, not-for-profit, is authorized. Use for-profit is
- X authorized with and only with the written consent of Author.
- X*/
- X
- Xstatic char *path_server = "\n...!cs.utexas.edu!bodedo.ucm.org!ucm-request (ucm-request@bodedo.ucm.org)";
- X
- X/* this program over-indulges in building large areas of static text, but it
- X * sure beats zillions of puts' and I wanted to bundle the whole program
- X * rather than have bunches of text files running around... */
- X
- Xstatic char *the_intro[] = {
- X"Simply, you can send requests to the server to find matching people on the",
- X"network (and on the ucm BBS network) with whom you may correspond via",
- X"electronic mail. If your account is not authorized to send mail to other",
- X"computers, you will find it *exceptionally* difficult to use this program.",
- X"",
- X"This program places two files in your home directory... the first is a set",
- X"of essay questions for you to fill out and the second is a letter for you to",
- X"mail to the gateway server.",
- X"",
- X"To completely start over, remove the ucm.essay from your home directory and",
- X"run this program again. If you have already filed an essay (from when you",
- X"ran this program before) you will now proceed with the multiple-choice",
- X"portion of the questionnaire.", NULL };
- X
- X/* this text will be put in $HOME/ucm.essay for the user to edit with vi or
- X * whatever turns them on. Hopefully placing no restriction on the size of
- X * the essay won't prove to be an unwise decision */
- X
- Xstatic char *essay_txt[] = {
- X"First, where are you located (School/Organization,City,State,Country) and",
- X"what is a good mail path to your site?",
- X">", "",
- X"If you could choose the ideal date, what would he/she be like?",
- X">", "",
- X"Where do you usually find your lovers and/or friends?",
- X">", "",
- X"Describe your personality type? What type are you attracted to?",
- X">", "",
- X"What type of music do you enjoy?",
- X">", "",
- X"What kind of magazines/newspapers/books do you read? Favorite authors?",
- X">", "",
- X"Where would you like to be tomorrow? 2 years? 5 years?",
- X">", "",
- X"You may enter any additional autobiographical comments - Please Be Honest!!",
- X">", NULL };
- X
- X/* a thousand apologies if you find these questions incomplete, biased,
- X * or otherwise offensive -- we tried to be general but it's just not possible
- X */
- X
- Xstatic char *question[] = {
- X"What is your sex?",
- X"Male",
- X"Female",
- XNULL,
- X"What is your sexual preference?",
- X"Heterosexual",
- X"Bisexual",
- X"Gay",
- XNULL,
- X"How old are you?",
- X"Under 15",
- X"15 - 17",
- X"18 - 20",
- X"21 - 25",
- X"26 - 30",
- X"31 - 35",
- X"36 - 40",
- X"41 - 45",
- X"46 - 50",
- X"51 - 60",
- X"Over 60",
- XNULL,
- X"What is your weight?",
- X"Less than 100# (45Kg)",
- X"100-125# (45-57Kg)",
- X"126-140# (57-64Kg)",
- X"141-160# (64-73Kg)",
- X"161-180# (73-82Kg)",
- X"181-200# (82-91Kg)",
- X"201-220# (91-100Kg)",
- X"221-250# (100-114Kg)",
- X"Over 250# (114Kg)",
- X"I broke the truckstop scale",
- XNULL,
- X"What is your height?",
- X"Under 5' (152cm)",
- X"5'-5'2\" (152-157cm)",
- X"5'2\"-5'4\" (157-163cm)",
- X"5'4\"-5'6\" (163-168cm)",
- X"5'6\"-5'8\" (168-147cm)",
- X"5'8\"-5'10\" (147-178cm)",
- X"5'10\"-6' (178cm-183cm)",
- X"6'-6'2\" (183-188cm)",
- X"6'2\"-6'4\" (188-193cm)",
- X"Over 6'4\" (193cm)",
- XNULL,
- X"What is your sign?",
- X"Aquarius",
- X"Pisces",
- X"Aries",
- X"Gemini",
- X"Virgo",
- X"Capricorn",
- X"Cancer",
- X"Leo",
- X"Sagittarius",
- X"Libra",
- X"Scorpio",
- X"Taurus",
- X"Neon",
- X"One Way",
- X"Yield",
- XNULL,
- X"What is the color of your hair?",
- X"Brown hair",
- X"Black hair",
- X"Red hair",
- X"Blond hair",
- X"Auburn hair",
- X"Gray hair",
- X"Technicolor punk",
- X"Only my hairdresser knows",
- X"Bald",
- XNULL,
- X"What is the style of your hair?",
- X"Long straight hair",
- X"Long curly/wavy hair",
- X"Medium straight hair",
- X"Medium curly/wavy hair",
- X"Short straight hair",
- X"Short curly/wavy hair",
- X"My hair defies description",
- X"I'm totally bald, okay!",
- XNULL,
- X"What color eyes do you have?",
- X"Big Brown eyes",
- X"Deep Blue eyes",
- X"Sexy Hazel eyes",
- X"Wild Green eyes",
- X"Violet eyes",
- X"Steel-Grey eyes",
- X"Bloodshot eyes",
- X"Bette Davis eyes",
- X"Permanently crossed eyes",
- XNULL,
- X"Do you have eyewear?",
- X"My vision is perfect, I have no eyewear",
- X"I wear fashionable glasses",
- X"I wear nerd glasses",
- X"I wear contact lenses",
- X"I wear cheap sunglasses",
- X"My guide dog wears cheap sunglasses",
- XNULL,
- X"Your current living situation is?",
- X"Happily married",
- X"Not-so-happily married",
- X"Married and we swing",
- X"Divorced living alone",
- X"Divorced living with kid(s)",
- X"Divorced living with lover",
- X"Divorced living with roommate(s)",
- X"Single living in style",
- X"Single living with kid(s)",
- X"Single living with lover",
- X"Single living with roommate(s)",
- X"Student squalor",
- X"Living with parents",
- XNULL,
- X"What area of the world do you live in?",
- X"Northern United States",
- X"Southern United States",
- X"Eastern United States",
- X"Western United States",
- X"Canada",
- X"Mexico / Central - South America",
- X"Europe",
- X"Africa",
- X"Middle-East",
- X"Asia",
- X"Japan",
- X"Australia / South Pacific",
- X"Antarctica",
- X"Space (seriously!)",
- XNULL,
- X"In what type of dwelling do you live?",
- X"I reside in an apartment",
- X"I reside in a condo",
- X"I reside in a house",
- X"I reside in a mobile home",
- X"I reside in a townhouse",
- X"I reside in a dormitory",
- X"Wherever there's a bed",
- X"I stay in hotels / motels",
- XNULL,
- X"What type of transportation do you use?",
- X"Japanese luxury car",
- X"European luxury car",
- X"American luxury car",
- X"Japanese sports car",
- X"European sports car",
- X"American sports car",
- X"Japanese economy car",
- X"European economy car",
- X"American economy car",
- X"Truck",
- X"Van",
- X"Motorcycle",
- X"Bicycle / Skateboard",
- X"Via bus",
- X"My feet take me almost everywhere",
- X"Land barge",
- XNULL,
- X"What is your annual income?",
- X"Less than $10,000",
- X"$10,000 - $20,000",
- X"$20,000 - $30,000",
- X"$30,000 - $40,000",
- X"$40,000 - $50,000",
- X"$50,000 - $60,000",
- X"Over $60,000",
- X"None of your damn business!",
- X"What, me work?",
- XNULL,
- X"What type of work do you do (or what is your major)?",
- X"Executive",
- X"Administrative",
- X"Financial",
- X"Managerial",
- X"Clerical / Secretarial",
- X"Sales",
- X"Science / Engineering",
- X"Technical",
- X"Food services",
- X"Legal professions",
- X"Artistic / Musical / Writer",
- X"Medical / Dental",
- X"Political / Government",
- X"Transportation",
- X"Celebrity / Personality",
- X"Laborer / Construction",
- X"Student",
- X"Bummin' my way through life",
- X"Retired",
- X"Self employed",
- XNULL,
- X"Is age important to you?",
- X"I would like to meet someone older than me",
- X"I would like to meet someone close to my age",
- X"I would like to meet someone younger than me",
- X"Age is not important to me",
- XNULL,
- X"I prefer the following ethnic group:",
- X"White",
- X"Black",
- X"Oriental",
- X"Hispanic",
- X"Other",
- X"Ethnic group really doesn't matter to me",
- XNULL,
- X"Of this list, what is your favorite OUTDOOR activity?",
- X"Sports / Athletics",
- X"Travel",
- X"Automobiles / Motorcycles",
- X"Camping / Fishing / Hiking",
- X"Biking",
- X"Gardening / Plant growing",
- X"Photography",
- X"Flying / Ultra-lites",
- X"Picnics in the park",
- X"Swimming / Sailing / Scuba / Skiing",
- X"Golf / Tennis",
- X"Tan maintenance",
- X"Girl/Boy watching",
- X"Horseback riding",
- XNULL,
- X"Of this list, what is your favorite INDOOR activity?",
- X"Programming / Computers",
- X"Dancing",
- X"Theater / Movies",
- X"Listening to music",
- X"Attending concerts",
- X"Avid book reading",
- X"Cooking / Culinary arts",
- X"Watching TV",
- X"Weight lifting",
- X"Photography",
- X"Wine tasting",
- X"Video games",
- X"Hot tubbing",
- X"Bar hopping",
- X"Hanging out at the mall",
- X"Ceramics / Crafts / Painting",
- XNULL,
- X"What is your favorite type of music?",
- X"Rock & Roll",
- X"Pop / Top 40",
- X"Oldies but Goodies",
- X"New Wave",
- X"Punk",
- X"Soul",
- X"Disco",
- X"Jazz",
- X"Rhythm and Blues",
- X"Classical",
- X"Opera",
- X"Folk",
- X"Reggae",
- X"Country and Western",
- X"Christian / Gospel",
- X"Movie sound tracks",
- XNULL,
- X"Do you favor a particular color?",
- X"Red is my favorite color",
- X"Orange is my favorite color",
- X"Yellow is my favorite color",
- X"Green is my favorite color",
- X"Blue is my favorite color",
- X"Indigo is my favorite color",
- X"Purple is my favorite color",
- X"Brown is my favorite color",
- X"White is my favorite color",
- X"Black is my favorite color",
- X"Pink is my favorite color",
- X"No favorite color",
- XNULL,
- X"How would you describe your sense of humor?",
- X"I rarely tell jokes or laugh",
- X"I enjoy a good joke or story",
- X"I love telling jokes and stories",
- X"I am going to be the next Groucho Marx",
- X"I live in the Far Side",
- X"I live for rec.humor",
- X"I am very sarcastic",
- X"I'm the life of the party when I've had too much to drink",
- X"We are not amused",
- XNULL,
- X"If you could have any pet, which one of the following would you choose?",
- X"Dog",
- X"Cat",
- X"Horse",
- X"Reptile",
- X"Rodent",
- X"Fish",
- X"Bird",
- X"Some other pet",
- X"Stuffed animal",
- X"Pet rock",
- X"I do not like pets",
- XNULL,
- X"Do you drink?",
- X"I do not drink",
- X"I drink socially",
- X"I drink daily",
- X"I drink like a fish",
- XNULL,
- X"Do you smoke?",
- X"I do not smoke",
- X"I smoke in moderation",
- X"I smoke like a chimney",
- X"I occasionally get high",
- X"I get high daily",
- X"I never come down",
- X"I'm kicking the habit",
- XNULL,
- X"I have:",
- X"Very good looks",
- X"Above average looks",
- X"Middle of the road looks",
- X"Bad part of the road looks",
- X"Road Closed / Bring your bag",
- XNULL,
- X"You might be best described as:",
- X"Intelligent / Cautious",
- X"Romantic / Optimistic",
- X"Cheerful / Realistic",
- X"Daring / Wild",
- X"Quiet / Serene",
- X"Naive / Sheltered",
- X"Bleak / Moody",
- X"Just plain stupid",
- XNULL,
- X"Is religion a part of your life?",
- X"Religion is a large part of my life",
- X"I am moderately religious",
- X"Religion is not a part of my life",
- XNULL,
- X"Describe your television viewing habits.",
- X"I watch at least one network show a night",
- X"I watch at least one cable show a night",
- X"I have a half dozen weekly favorites",
- X"T.V. was made to watch football/baseball",
- X"I watch PBS exclusively",
- X"It's on MTV and the knob is gone",
- X"Just HBO/Showtime stuff",
- X"T.V. was made for CNN headline news",
- X"Only rented movies",
- X"I'm Captain Midnight!",
- X"I wait 'till the signoff and watch the snow",
- X"I don't watch television",
- XNULL,
- X"Where would you prefer to live?",
- X"A farm in the country",
- X"A cottage in the country",
- X"In the heart of the city",
- X"An apartment in the suburbs",
- X"A house in the suburbs",
- X"In a small town",
- X"A Mondo Condo in Florida",
- X"In my car / van",
- X"On another planet",
- X"You call this living?",
- X"Lost in the wilderness",
- X"On the move",
- X"On a yacht in the Caribbean Sea",
- X"With the Matchmaker",
- XNULL,
- X"Current education level:",
- X"Smart ass",
- X"Have not finished high school yet",
- X"High School",
- X"Technical School",
- X"College freshman",
- X"College sophomore",
- X"College junior",
- X"College senior ",
- X"Professional program",
- X"4 year degree",
- X"Masters degree",
- X"Doctorate degree",
- XNULL,
- X"When going somewhere,",
- X"I am usually early",
- X"I am usually on time",
- X"I am usually late",
- X"I go nowhere, fast",
- X"I never show up",
- XNULL,
- X"How many \"blue\" movies have you seen in the last year?",
- X"None, and I never will!",
- X"None, and I would love to",
- X"1 \"blue\" movies",
- X"2 - 5 \"blue\" movies",
- X"Over 5 \"blue\" movies",
- X"Countless \"blue\" movies",
- X"I am a stunt double",
- XNULL,
- X"Pick a Great Escape:",
- X"Beach strolling along the Riviera",
- X"A Jacuzzi by candlelight in Rome",
- X"A romantic dinner in Paris",
- X"Sailing to the Caribbean",
- X"Toasting the Japanese sunrise",
- X"Driving up the California coastline",
- X"A train ride through Switzerland",
- X"Tea for two in London",
- X"A weekend in Las Vegas",
- X"Hiking down the Grand Canyon",
- X"A ride on the Space Shuttle",
- X"A bottle of Ripple on a Saturday night",
- XNULL,
- X"Which is your favorite season?",
- X"Winter",
- X"Spring",
- X"Summer",
- X"Fall",
- X"Football",
- XNULL,
- X"What style of dress do you prefer?",
- X"I like to get dressed up",
- X"I like to dress casual",
- X"I dress for the occasion",
- X"What ever is clean",
- X"Preppy",
- X"Punk",
- X"Nude",
- X"Just call me Fred Flintstone",
- XNULL,
- X"I would rather watch a movie:",
- X"In the theater",
- X"At home / VCR",
- X"At the drive in",
- X"In a booth with lotsa quarters",
- X"I hate movies",
- XNULL,
- X"When I fall in love:",
- X"I usually settle down with one partner",
- X"I usually look for more partners",
- X"I lose my lovers and get hurt",
- X"I discard my lovers after awhile",
- X"I usually get married",
- X"I have never fallen",
- X"I fall apart",
- XNULL,
- X"What would you expect on a first date?",
- X"A handshake",
- X"A kiss at the door",
- X"Light petting",
- X"Your place or mine?",
- X"Pure sexual ecstasy",
- X"If it's the right person anything can happen",
- X"Dinner?",
- XNULL,
- X"When I purchase items such as a TV, stereo, or clothing, I always:",
- X"Buy top of the line brand names",
- X"Spend the most I can afford",
- X"Buy the first one I see",
- X"Get the cheapest, on sale",
- X"Dig in the Goodwill dumpster",
- XNULL,
- X"What type of food do you enjoy most?",
- X"Chinese food",
- X"Italian food",
- X"Mexican food",
- X"French cuisine",
- X"American food",
- X"Vietnamese food",
- X"German food",
- X"Cajun food",
- X"Japanese food",
- X"East Indian food",
- X"Russian food",
- X"Seafood",
- X"Greek food",
- X"Fast food",
- X"Beer",
- X"Health food",
- XNULL,
- X"What type of movie do you like best?",
- X"Romance",
- X"Musicals",
- X"War",
- X"Western",
- X"Drama / Tear-jerkers",
- X"Science fiction",
- X"Animations",
- X"Comedy",
- X"Horror",
- X"Mystery",
- X"Pornographic",
- X"Adventure",
- X"Documentary",
- X"Fantasy",
- X"Action",
- X"I told you, I hate movies!",
- XNULL,
- X"Finally, why did you call?",
- X"Hoping to start a serious relationship",
- X"Seeking an occasional lover",
- X"Hunting for a roommate",
- X"Scouting out for swinging couples",
- X"Looking for a pen pal / friend",
- X"Just looking / Curious",
- X"A friend put me up to this",
- X"Looking for a one-night-stand",
- X"A system mis-routed my mail",
- X"I don't know and I won't call back!",
- XNULL, NULL };
- X
- Xstatic char *t_essay[] = {
- X"This program is divided into two parts. In the first part is an essay-style",
- X"questionnaire and the second is multiple choice. The program will stop now",
- X"and ask you to fill in your essay questionnaire using your favorite editor.",
- X"Place your response to each question after the '>' prompt provided. You may",
- X"enter as much text as you like, but please keep the text within an 80 column",
- X"screen-width. Leave a blank line between questions for neatness' sake. You",
- X"may add, remove or modify questions to suit your own [good!] tastes. Note",
- X"that while the gateway administrator supports your freedom of speech, the",
- X"gentle reader will appreciate your consideration of their sensibilities. If",
- X"you still feel compelled to be risque', run it through rot13!","",
- X"Keep your answers brief as other sites will be paying to transmit them.",
- XNULL };
- X
- X/* zip is included because the BBS program uses it -- in a large metropolitan
- X * area, like the ones ALAMO, HOUSTON and SILICON are located in, one cross-
- X * references the zip with the area of town they live in -- on a more global
- X * scale, the zip just becomes a reasonably meaningless statistic -- however,
- X * it is included in the match lists -- so perhaps it will be of some use */
- X
- Xstatic char *t_zip[] = {
- X"When asked for your ZIP code, you may respond with any 5 digit number that",
- X"you feel is representative of your location. If you live outside of the",
- X"United States, it's suggested that you enter the 3-digit country code used",
- X"for international telephone dialing. As the essay portion asked for your",
- X"location and as the multiple-choice portion will ask which area of the world",
- X"you live in the ZIP code will be primarily used for statistical purposes.",
- XNULL };
- X
- X/* an expiration date of 0 means "unlimited" -- again, this is a carryover
- X * from the BBS software which uses an expiration date to credit time to
- X * users' accounts. 5 bucks says almost everybody puts outrageous windows even
- X * tho' they can change it easily later */
- X
- Xstatic char *ex_text[] = {
- X"The next thing you will be asked for is an expiration window. This is the",
- X"number of months that you intend to be available to the net. For example,",
- X"if you are graduating in a year, put 12 months. A reasonable expiration",
- X"window helps the gateway administrator in removing inactive accounts. Note",
- X"that your account will be terminated for 40 days of inactivity but if your",
- X"account is within its expiration window you will be notified at the 30 day",
- X"mark. Your expiration window may be easily modified in the future so PLEASE",
- X"be reasonable.",NULL };
- X
- X/* initial requests for help information from the server and a match list.
- X * 100 people is a pretty big match list @ about 90 characters per line.
- X * with the Help the letter they get back jumps to about 14-15K bytes */
- X
- Xstatic char *in_letter[] = {
- X"", "",
- X"If a friend has already received help information from the request server,",
- X"please delete the following %help line to cut down on the volume of traffic",
- X"back to your site. Thanks!",
- X"%help", "",
- X"The following asks for a list of systems on the network. It's included just",
- X"FYI.", "%sites", "",
- X"The following asks for the top 100 people that you match across all systems.",
- X"%match c 100 allsys",
- X"", "Good Luck!", NULL };
- X
- Xstatic char *last_text[] = {
- X"That's it! Now all you need to do is mail off the letter that was created",
- X"by this program to the gateway server.","","Good Luck!", NULL };
- X
- X/* seriously, good luck! matchmaker software has been reported as producing
- X * results "beyond your wildest expectations" - your actual mileage may vary */
- X
- Xmain()
- X{
- X FILE *stream, *essay, *fopen();
- X char ans, *my_home, my_essay[90], the_letter[90], name[11], e_buf[80];
- X char *getenv(), *fgets();
- X int an_int, qnum, anum, qvect;
- X long zip;
- X register char *cs;
- X
- X /* grab the $HOME environment variable -- one can only imagine the
- X * bizzare circumstances under which it wouldn't be there */
- X if ((my_home = getenv("HOME")) == NULL) {
- X fprintf(stderr,"Help! I can't go $HOME!\n");
- X exit(-1);
- X }
- X
- X printf("This program allows you to find your match on the network by corresponding\n");
- X printf("with a matchmaking daemon at %s\n",path_server);
- X putext(the_intro,stdout);
- X printf("\nDo you wish to continue [N] ? ");
- X if (get1char() != 'Y')
- X exit(0);
- X sprintf(my_essay,"%s/ucm.essay",my_home);
- X /* if the essay exists we're in phase 2, else we're in phase 1. */
- X /* phase 1 creates the essay, phase 2 assumes that phase 1 has
- X * created the essay and that the user has already edited it */
- X if ((essay = fopen(my_essay,"r")) == NULL)
- X if ((essay = fopen(my_essay,"w")) == NULL) {
- X perror(my_essay);
- X fprintf(stderr,"Your essay couldn't be created. Fix your $HOME and run this program again.\n");
- X exit(-1);
- X }
- X else {
- X putext(essay_txt,essay);
- X fclose(essay);
- X putext(t_essay,stdout);
- X printf("\nEdit %s and run this program again.\n",
- X my_essay);
- X exit(0);
- X }
- X
- X /* open $HOME/ucm.letter -- the letter that will be mailed off */
- X sprintf(the_letter,"%s/ucm.letter",my_home);
- X if ((stream = fopen(the_letter,"w")) == NULL) {
- X perror(the_letter);
- X fprintf(stderr,"Your letter text couldn't be created. Fix your $HOME and run this again.\n");
- X exit(-1);
- X }
- X
- X /* get name and other personal data -- this is checked again (more
- X * vigorously) by the gateway server -- don't want it bouncing back */
- X printf("\nEnter your first name (experience advises against \"handles\")\n");
- Xn_oops:
- X printf("\nFirst name (2-10 characters) ? ");
- X scanf("%10s%*[^\n]",name);
- X if (strlen(name) < 2) {
- X printf("\nName too short use 2-10 characters.\n");
- X goto n_oops;
- X }
- X for (cs=name; *cs; cs++)
- X if (isascii(*cs) && islower(*cs))
- X *cs = toupper(*cs);
- X
- X for (cs=name; *cs; cs++) {
- X if (*cs >= 'A' && *cs <= 'Z')
- X continue;
- X if (*cs == '!' || *cs == '.')
- X continue;
- X printf("\nBogus character, '%c', try again.\n",*cs);
- X goto n_oops;
- X }
- X printf("\nYou entered \"%s\" -- correct [N] ? ",name);
- X if (get1char() != 'Y')
- X goto n_oops;
- X fprintf(stream,"%%new %s",name);
- X
- X putext(t_zip,stdout);
- Xz_oops:
- X printf("\nWhat is your ZIP code ? ");
- X scanf("%ld%*[^\n]",&zip);
- X if (zip < -9999L || zip > 99999L) {
- X printf("\nBogus ZIP code.\n");
- X goto z_oops;
- X }
- X fprintf(stream," %ld",zip);
- X
- Xbm_oops:
- X printf("\nWhat MONTH were you born in (1-12) ? ");
- X scanf("%d%[^\n]",&an_int);
- X if (an_int < 1 || an_int > 12) {
- X printf("\nBogus MONTH.\n");
- X goto bm_oops;
- X }
- X fprintf(stream," %d",an_int);
- X
- Xbd_oops:
- X printf("\nWhat DAY were you born on (1-31) ? ");
- X scanf("%d%[^\n]",&an_int);
- X if (an_int < 1 || an_int > 31) {
- X printf("\nBogus DAY.\n");
- X goto bd_oops;
- X }
- X fprintf(stream," %d",an_int);
- X
- X putext(ex_text,stdout);
- Xex_oops:
- X printf("\nAn expiration in months from today (1-24) ? ");
- X scanf("%d%[^\n]",&an_int);
- X if (an_int < 1 || an_int > 24) {
- X printf("\nBogus exipiration.\n");
- X goto ex_oops;
- X }
- X fprintf(stream," %d",an_int);
- X
- Xpw_oops:
- X printf("\nEnter a PASSWORD (2-10 characters) ? ");
- X scanf("%10s%*[^\n]",name);
- X for (cs=name; *cs; cs++)
- X if (isascii(*cs) && islower(*cs))
- X *cs = toupper(*cs);
- X
- X for (cs=name; *cs; cs++) {
- X if (*cs >= 'A' && *cs <= 'Z')
- X continue;
- X if (*cs == '!' || *cs == '.')
- X continue;
- X printf("\nBogus character, '%c', try again.\n",*cs);
- X goto pw_oops;
- X }
- X fprintf(stream," %s\n",name);
- X
- X /* copy essay responses to letter text */
- X while (fgets(e_buf,79,essay) != NULL) {
- X if (an_int = strlen(e_buf))
- X if (e_buf[an_int-1] == '\n')
- X e_buf[an_int-1] = '\0';
- X fprintf(stream,"%%e %s\n",e_buf);
- X }
- X fclose(essay);
- X
- X /* multiple choice portion */
- X fprintf(stream,"%%ans ");
- X qnum = qvect = 0;
- X
- X do {
- Xq_oops:
- X /* ask question */
- X printf("\n%d. %s\n",++qnum,question[qvect]);
- X /* print answers */
- X for (anum=1; question[qvect+anum] != NULL; ++anum)
- X printf("\t%c. %s\n",anum-1+'A',question[qvect+anum]);
- X printf("\nChoose A-%c ? ",'A'+anum-2);
- X ans = get1char();
- X if (ans < 'A' || ans > 'A'+anum-2) {
- X printf("\nBogus. Use A-%c.\n",'A'+anum-2);
- X goto q_oops;
- X }
- X /* write it to the letter */
- X putc(ans,stream);
- X } while (question[qvect += ++anum] != NULL);
- X
- X /* text to show systems, make a match, etc */
- X putext(in_letter,stream);
- X fclose(stream);
- X
- X /* we're done message */
- X putext(last_text,stdout);
- X printf("\nPlease examine %s before mailing it off to the server.\n",
- X the_letter);
- X printf("\nWhen you're all done, mail it to: %s\n",path_server);
- X exit(0);
- X}
- X
- Xget1char()
- X{
- X char answer[255];
- X
- X scanf("%1s%*[^\n]",answer);
- X
- X if (isascii(*answer) && islower(*answer))
- X return(toupper(*answer));
- X else
- X return(*answer);
- X}
- X
- Xputext(the_text,where)
- Xchar *the_text[];
- XFILE *where;
- X{
- X register int loop;
- X
- X if (where == stdout)
- X putchar('\n'); /* screen stuff gets a blank line before it */
- X for (loop=0; the_text[loop] != NULL; )
- X fprintf(where,"%s\n",the_text[loop++]);
- X}
- END_OF_FILE
- if test 22563 -ne `wc -c <'matchmaker.c'`; then
- echo shar: \"'matchmaker.c'\" unpacked with wrong size!
- fi
- # end of 'matchmaker.c'
- fi
- echo shar: End of shell archive.
- exit 0
-